//
//  GLGWSpeechRecognizer.h
//  GLGW_Shoping
//
//  Created by yang on 2018/12/28.
//  Copyright © 2018年 yang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <iflyMSC/iflyMSC.h> // 引入讯飞语音库

typedef void (^GLGWAudioRecognizerCallback)(NSString * __nullable resText,NSError * __nullable eroor);
typedef void (^GLGWAudioRecognizerCallend)(void);


NS_ASSUME_NONNULL_BEGIN

@interface GLGWSpeechRecognizer : NSObject
@property(nonatomic, strong) IFlySpeechRecognizer *iFlySpeechRecognizer;      // 定义语音听写对象
@property(nonatomic,assign) BOOL isonEndOfSpeech;
@property(nonatomic, copy) GLGWAudioRecognizerCallback glgw_recogcallback;
@property(nonatomic, copy) GLGWAudioRecognizerCallend glgw_recogcallend;

+ (instancetype)sharedInstanceIFly;
/**
 语音听写
 
 @param callback 听写结果回调
 */
+ (void)glgw_AudioRecognizerResult: (void(^)(NSString *resText,NSError *error))callback;
/**
 录音结束
 
 @param callEnd 录音结束
 */
+ (void)glgw_AudioRecognizerResultEnd: (void(^)(void))callEnd;

/*!
 *  停止录音<br>
 *  调用此函数会停止录音，并开始进行语音识别
 */
- (void) stopListening;

/*!
 *  取消本次会话
 */
- (void) cancel;
@end

NS_ASSUME_NONNULL_END
